Repository navigation
feat(transport): introduce stream I/O timeouts - #1518
Draft
rvolosatovs wants to merge 4 commits into
Draft
rvolosatovs wants to merge 4 commits into
rvolosatovs wants to merge 4 commits into
Conversation
rvolosatovs
force-pushed
the
feat/transport-io-timeout
branch
2 times, most recently
from
October 8, 2026 14:59
abaca76 to
7ee06eb
Compare
rvolosatovs
force-pushed
the
feat/transport-io-timeout
branch
from
October 23, 2026 13:38
7ee06eb to
216eeea
Compare
Add an optional timeout to `frame::Incoming` and `frame::Outgoing`, configured via `with_timeout` and shared by all sub-streams of the connection. When set, a read that does not make progress within the timeout fails with `ErrorKind::TimedOut` instead of pending forever, which lets peers drop invocations whose counterpart stops sending data, e.g. a client that sends fewer parameter bytes than the function signature requires and then keeps the stream open. The read deadline is cleared once it fires, so a read retried after a timeout gets a fresh window. `Outgoing` writes are buffered in a channel drained by a detached egress task, so the write timeout is applied there: egress fails if the underlying connection does not accept any data within the timeout, the result is passed to `on_egress` and subsequent writes, flushes and shutdowns on the stream surface the same error. A peer that stops reading from the connection therefore causes the connection to be released, instead of blocking it forever. The timeout is shared with the egress task through a slot that also holds its waker, so a timeout configured after the writer has already stalled still arms a deadline. The QUIC and WebTransport `on_egress` handlers reset the send stream and return when egress fails, so that the peer observes the failure and the handler does not wait for a `stopped()`, which quinn never resolves for a locally reset stream. Assisted-by: claude:claude-fable-5-1 Assisted-by: claude:claude-opus-5-5
When a transport drains ingress after all `Incoming` handles are dropped, a peer that never closes its end previously kept the ingress task and the connection alive forever. If a read timeout is set, fail ingress with `ErrorKind::TimedOut` once the peer does not close the stream within the timeout after all handles are dropped, releasing the connection. Assisted-by: claude:claude-opus-5-5
Add `invoke::IoTimeout` and `invoke::IoTimeoutOwned` wrappers, which bound the `Invoke::invoke` call, including the synchronous parameter write, and apply a read and write timeout to the `Incoming` and `Outgoing` streams it returns, so that an invocation errors instead of hanging when the server stops reading or responding mid-invocation. This is kept separate from `InvokeExt::timeout`, which still only bounds the `Invoke::invoke` call, since an I/O timeout also bounds the handler's time to first result byte and applies to async sub-streams, which may legitimately outlive the invocation and idle for longer. Assisted-by: claude:claude-fable-5-1 Assisted-by: claude:claude-opus-5-5
Add `serve::IoTimeout` and `serve::IoTimeoutOwned` wrappers, mirroring the `invoke` ones, which apply a read and write timeout to the `Incoming` and `Outgoing` streams of every accepted invocation. A client that sends fewer parameter bytes than the served function expects and then keeps the connection open previously left the server-side decoder pending forever (#1045); with a timeout the invocation now fails with `ErrorKind::TimedOut` and its resources are released. Likewise, a client that stops reading results no longer blocks the connection forever. The timeout does not bound reads a transport does before yielding an invocation, such as the header read in `frame::Server::accept`. Closes #1045 Assisted-by: claude:claude-fable-5-1 Assisted-by: claude:claude-opus-5-5
rvolosatovs
force-pushed
the
feat/transport-io-timeout
branch
from
October 23, 2026 14:25
216eeea to
1aaee8e
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
closes #1045